/*
 * @Description:
 * @Author: zheng yiliang
 * @Date: 2021-03-27 17:19:21
 * @LastEditTime: 2021-04-01 21:01:16
 * @LastEditors: zheng yiliang
 */

class BaseModel {
  constructor(data, message, code) {
    if (typeof data === 'string') {
      this._RejCode = code
      this._RejMsg = data
      data = null
      message = null
    }
    if (data) {
      this._RejCode = code
      this.data = data
    }
    if (message) {
      this._RejMsg = message
    }
  }
}

class SuccessModel extends BaseModel {
  constructor(data, message) {
    super(data, message, '00000000')
  }
}

class ErrorModel extends BaseModel {
  constructor(data, code = '999') {
    super(data, null, code)
  }
}

module.exports = {
  SuccessModel, ErrorModel
}